namespace VAdvantage.Model
{

    /** Generated Model - DO NOT CHANGE */
    using System;
    using System.Text;
    using VAdvantage.DataBase;
    using VAdvantage.Common;
    using VAdvantage.Classes;

    using VAdvantage.Process;
    using VAdvantage.ProcessEngine;
    using VAdvantage.Model;
    using VAdvantage.Utility;
    using System.Data;
    /** Generated Model for AD_Org
     *  @author Jagmohan Bhatt (generated) 
     *  @version Vienna Framework 1.1.1 - $Id$ */
    public class X_AD_Org : PO
    {

        public X_AD_Org(Context ctx, int AD_Org_ID, String trxName)
            : base(ctx, AD_Org_ID, trxName)
        {
            /** if (AD_Org_ID == 0)
            {
            SetIsSummary (false);
            SetName (null);
            SetValue (null);
            }
             */
        }
        public X_AD_Org(Ctx ctx, int AD_Org_ID, String trxName)
            : base(ctx, AD_Org_ID, trxName)
        {
            /** if (AD_Org_ID == 0)
            {
            SetIsSummary (false);
            SetName (null);
            SetValue (null);
            }
             */
        }
        /** Load Constructor 
        @param ctx context
        @param rs result set 
        @param trxName transaction
        */
        public X_AD_Org(Context ctx, DataRow rs, String trxName)
            : base(ctx, rs, trxName)
        {
        }
        /** Load Constructor 
        @param ctx context
        @param rs result set 
        @param trxName transaction
        */
        public X_AD_Org(Ctx ctx, DataRow rs, String trxName)
            : base(ctx, rs, trxName)
        {
        }
        /** Load Constructor 
        @param ctx context
        @param rs result set 
        @param trxName transaction
        */
        public X_AD_Org(Ctx ctx, IDataReader dr, String trxName)
            : base(ctx, dr, trxName)
        {
        }
        /** Serial Version No */
        static long serialVersionUID = 27542468341347L;
        /** Last Updated Timestamp 12/9/2009 12:47:04 PM */
        public static long updatedMS = 1260343024558L;
        /** AD_Table_ID=155 */
        public static int Table_ID = 155;

        /** TableName=AD_Org */
        public static String Table_Name = "AD_Org";

        protected static KeyNamePair model = new KeyNamePair(155, "AD_Org");

        protected Decimal accessLevel = new Decimal(7);
        /** AccessLevel
        @return 7 - System - Client - Org 
        */
        protected override int Get_AccessLevel()
        {
            return Convert.ToInt32(accessLevel.ToString());
        }
        /** Load Meta Data
        @param ctx context
        @return PO Info
        */
        protected override POInfo InitPO(Context ctx)
        {
            POInfo poi = POInfo.GetPOInfo(ctx, Table_ID);
            return poi;
        }
        /** Load Meta Data
        @param ctx context
        @return PO Info
        */
        protected override POInfo InitPO(Ctx ctx)
        {
            POInfo poi = POInfo.GetPOInfo(ctx, Table_ID);
            return poi;
        }
        /** Info
        @return info
        */
        public override String ToString()
        {
            StringBuilder sb = new StringBuilder("X_AD_Org[").Append(Get_ID()).Append("]");
            return sb.ToString();
        }
        /** Set Description.
        @param Description Optional short description of the record */
        public void SetDescription(String Description)
        {
            if (Description != null && Description.Length > 255)
            {
                log.Warning("Length > 255 - truncated");
                Description = Description.Substring(0, 255);
            }
            Set_Value("Description", Description);
        }
        /** Get Description.
        @return Optional short description of the record */
        public String GetDescription()
        {
            return (String)Get_Value("Description");
        }
        /** Set Summary Level.
        @param IsSummary This is a summary entity */
        public void SetIsSummary(Boolean IsSummary)
        {
            Set_Value("IsSummary", IsSummary);
        }
        /** Get Summary Level.
        @return This is a summary entity */
        public Boolean IsSummary()
        {
            Object oo = Get_Value("IsSummary");
            if (oo != null)
            {
                if (oo.GetType() == typeof(bool)) return Convert.ToBoolean(oo);
                return "Y".Equals(oo);
            }
            return false;
        }
        /** Set Name.
        @param Name Alphanumeric identifier of the entity */
        public void SetName(String Name)
        {
            if (Name == null) throw new ArgumentException("Name is mandatory.");
            if (Name.Length > 60)
            {
                log.Warning("Length > 60 - truncated");
                Name = Name.Substring(0, 60);
            }
            Set_Value("Name", Name);
        }
        /** Get Name.
        @return Alphanumeric identifier of the entity */
        public String GetName()
        {
            return (String)Get_Value("Name");
        }
        /** Get Record ID/ColumnName
        @return ID/ColumnName pair */
        public KeyNamePair GetKeyNamePair()
        {
            return new KeyNamePair(Get_ID(), GetName());
        }
        /** Set Search Key.
        @param Value Search key for the record in the format required - must be unique */
        public void SetValue(String Value)
        {
            if (Value == null) throw new ArgumentException("Value is mandatory.");
            if (Value.Length > 40)
            {
                log.Warning("Length > 40 - truncated");
                Value = Value.Substring(0, 40);
            }
            Set_Value("Value", Value);
        }
        /** Get Search Key.
        @return Search key for the record in the format required - must be unique */
        public String GetValue()
        {
            return (String)Get_Value("Value");
        }
        ///** Get Name.
        //@return Alphanumeric identifier of the entity */
        //public int GetAD_Image_ID()
        //{
        //    return (int)Get_Value("AD_Image_ID");
        //}
        //public void SetAD_Image_ID(int AD_Image_ID)
        //{
        //    Set_Value("AD_Image_ID", AD_Image_ID);
        //}
        public void SetIsLegalEntity(Boolean IsLegalEntity)
        {
            Set_Value("IsLegalEntity", IsLegalEntity);
        }
        /** Get Legal Entity.
        @return Legal Entity */
        public Boolean IsLegalEntity()
        {
            Object oo = Get_Value("IsLegalEntity");
            if (oo != null)
            {
                if (oo.GetType() == typeof(bool)) return Convert.ToBoolean(oo);
                return "Y".Equals(oo);
            }
            return false;
        }
    }

}
